<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        #canvas{
            border: 1px solid;
        }
    </style>
</head>
<body>
    <canvas width="400" height="400" id="canvas">
        请升级你的服务器
    </canvas>
    <script>
        var canvasBox = document.querySelector('#canvas')
        var context = canvasBox.getContext('2d');
        console.log('context',context)
        context.fillStyle='#f99';
       
        var left = 0;
        setInterval(function () {
            left++
            // 清屏 绘制 渲染 
            // 动画实质就是静态画面连续播放
            context.clearRect(0, 0, 400, 400);
            context.fillRect(left,200,100,100);
        },1000/60)
        
        
    </script>
</body>
</html>